/**
 * Copyright (c) 2009  Collaborative Development Group, C.S. Dept., University of Bari
 *
 * All rights reserved. This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License v1.0  which accompanies this distribution, and is 
 * available at http://www.eclipse.org/legal/epl-v10.html
 */
package it.uniba.di.cdg.jtalk.ui.chat;

import static it.uniba.di.cdg.jtalk.ui.chat.IChatPresentationModel.*;
import static it.uniba.di.cdg.penelope.presenterfirst.TestHelpers.assertPropertyChangeListenerNotified;
import static org.mockito.Mockito.mock;
import it.uniba.di.cdg.jtalk.ui.login.LoginPresentationModel;

import java.beans.PropertyChangeListener;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

/**
 * Unit tests for {@link LoginPresentationModel} implementation.
 */
@RunWith( MockitoJUnitRunner.class ) 
public class ChatPresentationModelTest {
	
	private ChatPresentationModel presentationModel;
	private PropertyChangeListener listener;

	@Before
	public void setUp() {
		this.presentationModel = new ChatPresentationModel();
		this.listener = mock( PropertyChangeListener.class );
		
		presentationModel.addPropertyChangeListener( listener );
	}
	
	@Test
	public void shouldNotifyTextToSendChange() {
		presentationModel.setTextToSend( "new" );
	
		assertPropertyChangeListenerNotified( listener, TEXT_TO_SEND_PROPERTY, "", "new" );
	}

	@Test
	public void shouldNotifyChatLogChange() {
		presentationModel.setChatLog( "new" );
	
		assertPropertyChangeListenerNotified( listener, CHAT_LOG_PROPERTY, "", "new" );
	}
}
